import {defineStore} from "pinia";
import {getAllRoutes} from "@/api/user/router"
import {asyncRoutes, constantRoutes} from "@/router";

const useRoutes = defineStore('useRoutes', {

    state: () => {
        return {
            routes: [],
        }
    },

    getters: {
        getRoutes: (state) => {
            return state.routes
        }
    },

    actions: {
        async setAllRoutes() {
            // 更具登陆的用户信息从数据库拿到路由
            let {data} = await getAllRoutes(null)
            this.routes = data
        }
    }
})
